package com.xiaoq.order.thirdpayinfo.tencent.service;

import com.xiaoq.order.thirdpayinfo.tencent.common.Configure;
import com.xiaoq.order.thirdpayinfo.tencent.common.HttpsRequest;
import com.xiaoq.order.thirdpayinfo.tencent.protocol.unifiedorder_protocol.UnifiedOrderReqData;

public class UnifiedOrderService extends BaseService {

	public UnifiedOrderService() throws IllegalAccessException,
			InstantiationException, ClassNotFoundException {
		super(Configure.UNIFIEDORDER_API);
	}

	public UnifiedOrderService(String certPath, String certPassword) throws Exception {
		super(Configure.UNIFIEDORDER_API, certPath, certPassword);
	}
	
	/**
	 * 请求支付服务
	 * 
	 * @param unifiedOrderReqData
	 *            这个数据对象里面包含了API要求提交的各种数据字段
	 * @return API返回的数据
	 * @throws Exception
	 */
	public String request(UnifiedOrderReqData unifiedOrderReqData)
			throws Exception {

		// --------------------------------------------------------------------
		// 发送HTTPS的Post请求到API地址
		// --------------------------------------------------------------------
		String responseString = sendPost(unifiedOrderReqData);

		return responseString;
	}

}
